<?php $this->load->view('lib/list_head')?>
<div class="span8">
	<div class="library-list">
		<div class="library-list-header">
			<h2 id="tagHeader">
			<?php $is_tag = $category==Variable::LIST_TAG;?>
			<?php if($is_tag && $tag_id!=0) {?>
			<a class="btn btn-small pull-right" data-toggle="modal" id="tagEditBtn" href="#" tag="<?php echo $category_name?>" tagId="<?php echo $tag_id;?>"><i class="icon-cog"></i> 编辑</a>
			<?php }?><span><?php echo $category_name?></span></h2>
		</div>
		<div class="library-list-items">
			<?php
			if($record_list) foreach ($record_list as $record)
			{
			?>
			<div class="library-list-item" id="recoder<?php echo $record->recordId?>">
				<?php if(!$is_tag) {?>
				<span class="label <?php echo $record->tag == '' ? 'label-warning' : 'label-info'?> pull-left"><?php echo $record->tag == '' ? '未分类' : strip_tags($record->tag)?></span>
				<?php } ?>
				<span class="pull-right"><a class="close" recordId="<?php echo $record->recordId?>">&times;</a> </span>
				<h4 class="<?php echo !$is_tag ? '' : 'taghide'?>"><a href="#" tag="<?php echo $record->tag == '' ? '未分类' : strip_tags($record->tag)?>" recordId="<?php echo $record->recordId?>"><?php echo strip_tags($record->memory) ?></a></h4>
				<p class="<?php echo !$is_tag ? '' : 'taghide'?>"><?php echo strip_tags($record->description) ?></p>
			</div>
			<?php
			}
			else
			{
			?>
			<div class="alert alert-info">
				<a class="close" data-dismiss="alert">×</a>
				<strong>这里没有记忆卡哦！</strong>
			</div>
			<?php
			}
			?>
		</div>
		<?php if($count > 1) {?>
		<?php $base_url = $is_tag ? 'lib/'.$category.'/'.$tag_id.'/' : 'lib/'.$category.'/'?>  
		<div class="pagination">
		  <ul>
		    <!-- pre  -->
		  	<?php if($page != 1) {?>
		    <li><a href="<?php echo site_url($base_url.($page - 1))?>">上一页</a></li>
		    <?php }?>
		    
		    <!-- li  -->
		    <?php for($i = 1; $i <=$count; $i++) {?>
		    <?php $isCurrent = $i == $page;?>
		    <li <?php if($isCurrent) echo 'class="active"'?>>
		      <a href="<?php echo $isCurrent ? '#' : site_url($base_url.$i)?>"><?php echo $i?></a>
		    </li>
		    <?php }?>
		    
		    <!-- next  -->
		    <?php if($page != $count) {?>
		    <li><a href="<?php echo site_url($base_url.($page + 1))?>">下一页</a></li>
		    <?php }?>
		  </ul>
		</div>
		<?php }?>
	</div>
</div>
</div>
<div class="modal hide fade" id="recoderModal">
	<div class="modal-header">
		<a class="close" data-dismiss="modal">×</a>
		<h3>修改</h3>
	</div>
	<div class="modal-body recoder-edit">
		<div class="btn-toolbar" style="margin: 0;">
			<input type="hidden" value="" id="recoder-id" />
			<input class="span2" type="text" name="tag" id="tag-input" readOnly value="" placeholder="未分类" style="margin-top: -14px;">
			<div class="btn-group">
				<a class="btn dropdown-toggle btn-inverse" data-toggle="dropdown" id="tag-select" href="#">选择分类 <span class="caret"></span> </a>
				<ul class="dropdown-menu" id="tag-menu">
				</ul>
			</div>
		</div>
		<textarea class="input-xlarge" id="memory-input"  placeholder="可以输入一句话，也可是一段话。可以是英文，也可以是其他任何语言。"></textarea>
		<textarea class="input-xlarge" id="description-input"  placeholder="输入帮助记忆的内容。"></textarea>
	</div>
	<div class="modal-footer">
		<a href="#" class="btn" data-dismiss="modal">关闭</a>
		<a href="#" class="btn btn-primary" id="updaterecoderbtn">保存修改</a>
	</div>
</div>
<div class="modal hide fade" id="tagModal">
	<div class="modal-header">
		<a class="close" data-dismiss="modal">×</a>
		<h3>分类属性修改</h3>
	</div>
	<div class="modal-body recoder-edit">
		 
		<div class="btn-toolbar">
			<input type="hidden" value="" id="tag-id" />
			<input class="span2" type="text" name="tag" id="tag-editinput" value="" placeholder="" style="width: 200px;" >
			
		</div>
		
	</div>
	<div class="modal-footer">
		<a href="#" class="btn pull-left delTag" id="delTag">删除分类</a>
		<a href="#" class="btn" data-dismiss="modal">关闭</a>
		<a href="#" class="btn btn-primary" id="addtagbtn">确定</a>
		<a href="#" class="btn btn-primary" id="updatetagbtn">保存修改</a>
	</div>
</div>
<script>
var tagUrl ="<?php echo site_url('lib/tag/') ?>" 
bdc.lib.delRecoderHandler("<?php echo site_url('record/del') ?>");
bdc.lib.editRecoderHandler();
bdc.lib.updateRecoder("<?php echo site_url('record/update') ?>");
bdc.lib.tag.handler("<?php echo site_url('tag/update') ?>","<?php echo site_url('tag/del') ?>","<?php echo site_url('tag/add') ?>")
</script>